package com.yanqu.road.entity.union.parergon;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.utils.string.StringUtils;

import java.util.List;
import java.util.Objects;

public class UnionBussinessman extends DataObject {
    private int bussinessId;         //商人编号
    private String unionId;          //商会编号
    private long disappearTime;      //消失时间
    private int productId;           //礼包编号
    private long bargainPrice;       //价格
    private int bargainTimes;        //砍价次数
    private int bargainNum;          //可砍价次数
    private long createTime;                    //商人出现时间
    private List<Integer> bargainValues;        //砍价次数

    public int getBussinessId() {
        return bussinessId;
    }

    public void setBussinessId(int bussinessId) {
        if(this.bussinessId != bussinessId) {
            this.bussinessId = bussinessId;
            setUpdateOption();
        }
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        if(!Objects.equals(this.unionId, unionId)) {
            this.unionId = unionId;
            setUpdateOption();
        }
    }

    public long getDisappearTime() {
        return disappearTime;
    }

    public void setDisappearTime(long disappearTime) {
        if(this.disappearTime != disappearTime) {
            this.disappearTime = disappearTime;
            setUpdateOption();
        }
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        if(this.productId != productId) {
            this.productId = productId;
            setUpdateOption();
        }
    }

    public long getBargainPrice() {
        return bargainPrice;
    }

    public void setBargainPrice(long bargainPrice) {
        if(this.bargainPrice != bargainPrice) {
            this.bargainPrice = bargainPrice;
            setUpdateOption();
        }
    }

    public int getBargainTimes() {
        return bargainTimes;
    }

    public void setBargainTimes(int bargainTimes) {
        if(this.bargainTimes != bargainTimes) {
            this.bargainTimes = bargainTimes;
            setUpdateOption();
        }
    }

    public int getBargainNum() {
        return bargainNum;
    }

    public void setBargainNum(int bargainNum) {
        if(this.bargainNum != bargainNum) {
            this.bargainNum = bargainNum;
            setUpdateOption();
        }
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        if(this.createTime != createTime) {
            this.createTime = createTime;
            setUpdateOption();
        }
    }

    public String getBargainValuesStr() {
        return StringUtils.listToString(this.bargainValues, ",");
    }

    public long getBargainValue(int index) {
        if (index >= this.bargainValues.size()) {
            return 0;
        }
        return this.bargainValues.get(index);
    }

    public List<Integer> getBargainValues() {
        return bargainValues;
    }

    public void setBargainValues(List<Integer> bargainValues) {
        this.bargainValues = bargainValues;
        setUpdateOption();
    }
}
